<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html>
  <head>
  <base target="_self"/>
  
  <title>表单基本信息查看页面</title>
  	<meta http-equiv="X-UA-Compatible" content="IE=7" />
  	<%@ include file="../jslib/jquerylib.jsp" %>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	<style type="text/css">
   		html{
		    overflow-x: hidden;
		}  		
   </style>
    <script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    $().ready(function() {
    $('input,textarea',$('form[name="pageFrom"]')).prop('readonly',true);
    $('checkbox,select',$('form[name="pageFrom"]')).prop('disabled',true);
	$("#pageFrom").validate({
		onkeyup :false,onclick:false,
			rules: {
				fromName: {
				      required: true,
				      withoutspecial: true,
				      maxlength:40
				},
				fromColumn:{
					required:true,
					number:true
				}
			},
		messages: {
			fromName: {
			      required: "表单名称不能为空",
			      maxlength: "内容过长",
			      withoutspecial : "字符违规"
			},	
			fromColumn:{
				required:"表单列数不能为空",
				number:"表单列数只能为数字"
			}
		},  
	   /* 重写错误显示消息方法,以alert方式弹出错误消息 */  
	   showErrors : function(errorMap, errorList) {
		    var msg = "";  
		    $.each(errorList, function(i, v) {  
		     msg = (v.message + "\r\n");  
		    
		    if (msg != ""){  
		     alert(msg);
		     return false;  
		     }
		     });  
		   onfocusout=false; 
	   }
	  });  
			
				
    	// 准备好Options对象
    	var options = {
    	    url:'<%=request.getContextPath() %>/auto!updateForm.action',
    	    beforeSubmit: function() {
    			return $('#pageFrom').form('enableValidation').form('validate');
    		},
    	    dataType:'json',
    	    success: function(data) {
    	      if(data.result=='success'){
				alert("修改成功");
				api.close();
				W.gridSearch();
    	      }else{
    	      	alert("系统繁忙，请您稍后再试！");
    	      	api.close();
				W.gridSearch();
    	      }
    	}};
    	
		$('#saveBtn').click(function(){
			$('#pageFrom').ajaxSubmit(options);
			return false;
		});
		
		$('#closeBtn').click(function(){
			api.close();
		});
		//签章类型中显示图片
		if('${formid}'==4361){
		   var path = $("#T_QIANZHANGIMAGE_path").val();
		   if(path!=''&&path!=undefined){
		     $("#T_QIANZHANGIMAGE_Img").attr('src',"<%=request.getContextPath()%>/printImage.action?flag=0&path="+encodeURIComponent(path));
		   }
		}
	});

	function countlen(textarea){
	    if (textarea.value.length> 250){
	        alert("最多为250个字符,字符输入超出限制!");
	        textarea.value=textarea.value.substring(0,250);
	    }
	    return true;
	}
	
	function selectformtype(){
		var k = window.showModalDialog('autoFromsAction!getDicselectviewinfo.action?id=321',null,"dialogWidth=850px;dialogHeight=430px;resizable=yes");
		if (k==undefined)
		{
			k = '';
		}
		document.getElementById("suoslx").value = k;
	}
	
		//选择人员
	function selectperson(id)
	{
		var users = window.showModalDialog("<%=request.getContextPath() %>/user/chooseAllUser.jsp", window, "dialogWidth:1000px;status:no;dialogHeight:500px");
    	if (users != null) {
    		var userIds = [];
            var userNames = [];
            for(var i=0;i<users.length;i++){
                userIds.push(users[i]['userid']);
                userNames.push(users[i]['username']);
            }
            document.getElementById("user_"+id).value = userNames.join();
            document.getElementById(id).value = userIds.join();
    	}
	}
	
		//选择部门
	function selectdept(id)
	{
		var datas = window.showModalDialog("<%=basePath%>/resource/choose/choose_organizationIndex.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=550px");
		if(typeof(datas) == 'undefined'){
		}else{
			var json1 = eval('(' + datas + ')');
			 document.getElementById("dept_"+id).value = json1.ORG_NAME;
			 document.getElementById(id).value = json1.ORG_ID;
		}
	}
	
	//选择外键数据信息
	//参数信息：表明，关联列，显示列
	function selectData(id,tablename,colname,disname,cnname){
	    var fileColname ='hideFileName';
	    if(tablename=='DIC_STANDARD'){
	      fileColname = "YCLJS_GYYW";
	    }
		var datas = window.showModalDialog("<%=basePath%>/auto/auto_choose_list.jsp?flag=0&tablename="+tablename+"&colname="+colname+"&disname="+disname+"&cnname="+escape(encodeURIComponent(cnname))+"&fileColname="+fileColname+"&temp="+Math.round(Math.random()*10000),'',"dialogWidth=500px;dialogHeight=350px");
		if(typeof(datas) == 'undefined'){
		}else{
			var json1 = eval('(' + datas + ')');
			 document.getElementById("data_"+id).value = json1.NAME;
			 document.getElementById(id).value = json1.ID;
		}
	}
	function fileUpload(filePath){
		window.open("auto!getFileDownload.action?filePath="+escape(encodeURIComponent(filePath)));
	}
</script>

 <style type="text/css">
	body{
		background:#ffffff; background-image:url(images/);
	}
	.tab_input{border: 1px solid #999;padding: 5px;width: 250px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
</style>
</head>
<body>
  	<form action="<%=request.getContextPath() %>/auto!saveForm.action" id="pageFrom" name="pageFrom" method="post" class="easyui-form" data-options="novalidate:true">
  		<input type="hidden" id="formid" name="formid" value="${requestScope.formnew.id }"/>
  		<input type="hidden" id="columns" name="columns" value="${requestScope.columns }"/>
  		<input type="hidden" id="ID" name="ID" value="${requestScope.id}"/>
  		<table width="100%" border="0" align="center">
  			${requestScope.tableContent }
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
			<td align="center">
		      	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		</table>
	</form>
  </body>
</html>
